<template>
    <div>
        <Header :title="t('News')" />
        <main>
            <News :list="newsList" :indicate="t('home.Home.views')" />
        </main>
    </div>
</template>

<script setup>
import Header from "@/components/Header/index.vue";
import News from "@/components/News/index.vue";
import useLanguage from '@/hooks/useLanguage';
import { publicApi } from '@/api'
import { reactive, ref, onMounted } from 'vue'

const { t } = useLanguage()

const postData = reactive({
    pageNum: 1,
    pageSize: 10
})
const newsList = ref([])
async function getNewsList() {
    const { code, data, msg } = await publicApi.publicNews(postData)
    if (code == 20000) {
        const { records } = data
        console.log(records);
        newsList.value = records
    }
}

onMounted(() => {
    getNewsList()
})

</script>

<style lang="less" scoped>
main {
    padding: 15px 10px;
}
</style>